import { SPlayerItemUpdate } from "../../../../../Message/Game/SPlayerItemUpdate";
import { ItemData } from "../../../resource/info/ItemData";
import { UserEquipmentData } from "./UserEquipmentData";
import { EDressPos } from "../../../../../Message/Public/EDressPos";
import { EEntityAttribute } from "../../../../../Message/Public/EEntityAttribute";
import { PlayerEqStrengthInfo } from "../../player/equip/PlayerEqStrengthInfo";
//class UserEquipmentUtil
    
    export  class UserEquipmentUtil
    {
        

        public static getEquipmentData(arg1: Array<any>): Array<any>
        {
            var loc4=null;
            var loc5=null;
            var loc1=[];
            var loc2=arg1.length;
            var loc3=0;
            loc3 = 0;
            while (loc3 < 14) 
            {
                loc1.push(null);
                ++loc3;
            }
            loc3 = 0;
            while (loc3 < loc2) 
            {
                if ((loc4 = arg1[loc3] as SPlayerItemUpdate).playerItem) 
                {
                    loc5 = new ItemData(loc4.playerItem);
                    loc1[(loc4.posIndex - 1)] = loc5;
                }
                ++loc3;
            }
            return loc1;
        }

        public static getUserEquipmentData(arg1: Array<any>, arg2: Boolean, arg3: Boolean, arg4: Boolean, arg5: Boolean, arg6: Boolean, arg7: Boolean): UserEquipmentData
        {
            var loc11=0;
            var loc12=0;
            var loc1=new UserEquipmentData();
            arg2 = arg2;
            arg3 = arg3;
            arg4 = arg4;
            var loc2=new Map<any, any> /* flash.utils.Dictionary */();
            var loc3=arg1[(EDressPos._EDressPosFashionWeapon - 1)];
            var loc4=arg1[(EDressPos._EDressPosWeapon - 1)];
            var loc5=arg1[(EDressPos._EDressPosFashion - 1)];
            var loc6=arg1[(EDressPos._EDressPosClothes - 1)];
            var loc7=arg1[(EDressPos._EDressPosWing - 1)];
            var loc8=arg1[(EDressPos._EDressPosSurround - 1)];
            var loc9=arg1[(EDressPos._EDressPosWaistBelt - 1)];
            var loc10=arg1[(EDressPos._EDressPosElf - 1)];
            if (arg1 && loc3 && !arg4) 
            {
                loc2[EEntityAttribute._EAttributeWeapon] = loc3.itemExInfo.weaponfashionModel;
            }
            else if (arg1 && loc4) 
            {
                loc2[EEntityAttribute._EAttributeWeapon] = loc4.data.itemCode;
                loc11 = PlayerEqStrengthInfo.getStrengthen(loc4);
            }
            if (arg1 && loc5 && !arg2) 
            {
                loc2[EEntityAttribute._EAttributeClothes] = loc5.itemExInfo.fashionModel;
            }
            else if (arg1 && loc6) 
            {
                loc2[EEntityAttribute._EAttributeClothes] = loc6.data.itemCode;
            }
            if (arg1 && loc7 && !arg3) 
            {
                loc2[EEntityAttribute._EAttributeWing] = loc7.itemExInfo.windModel;
                if (loc7.itemExInfo.useWingModelLv != 0) 
                {
                    loc12 = loc7.itemExInfo.wingModelLv;
                }
                else 
                {
                    loc12 = PlayerEqStrengthInfo.getStrengthen(loc7);
                }
            }
            if (arg1 && loc8 && !arg5) 
            {
                loc2[EEntityAttribute._EAttributeSurround] = loc8.itemExInfo.SUModel;
            }
            if (arg1 && loc9 && !arg6) 
            {
                loc2[EEntityAttribute._EAttributeWaistBelt] = loc9.itemExInfo.WBModel;
            }
            if (arg1 && loc10 && !arg7) 
            {
                loc2[EEntityAttribute._EAttributeElf] = loc10.itemExInfo.ELFModel;
            }
            loc1.equipDic = loc2;
            loc1.weaponStPerLv = loc11;
            loc1.wingStLv = loc12;
            return loc1;
        }
    }
